//
//  UIView+CNExtension.h
//  CNLawyer
//
//  Created by 李孝宇 on 15/12/16.
//  Copyright © 2015年 OsGsCn. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef void(^TargetAction)(UITapGestureRecognizer *tap);
typedef void(^LongPressTargetAction)(UILongPressGestureRecognizer *tap);
@interface UIView (CNExtension)

@property (nonatomic, assign) CGSize size;
@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;

@property (nonatomic, assign) CGFloat k_width;
@property (nonatomic, assign) CGFloat k_height;

@property (nonatomic, assign) CGFloat k_left;
@property (nonatomic, assign) CGFloat k_top;

@property (nonatomic, assign) CGFloat k_centerX;
@property (nonatomic, assign) CGFloat k_centerY;

@property (nonatomic, assign) CGFloat k_right;
@property (nonatomic, assign) CGFloat k_bottom;


- (UIViewController *)viewController;

/** 添加点击事件 */
- (void)addTargetAction:(TargetAction)targetAction;

/** 添加长按事件 */
- (void)addLongPressTargetAction:(LongPressTargetAction)longPressTargetAction;

//淡入
- (void)hl_fadeInWithTime:(NSTimeInterval)time;
//淡出
- (void)hl_fadeOutWithTime:(NSTimeInterval)time;
//旋转
- (void)hl_RevolvingWithTime:(NSTimeInterval)time andDelta:(CGFloat)delta;


/**
 *  设置部分圆角(绝对布局)
 *
 *  @param corners 需要设置为圆角的角 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
 *  @param radii   需要设置的圆角大小 例如 CGSizeMake(20.0f, 20.0f)
 */
- (void)addRoundedCorners:(UIRectCorner)corners withRadii:(CGSize)radii;
/**
 *  设置部分圆角(相对布局)
 *
 *  @param corners 需要设置为圆角的角 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
 *  @param radii   需要设置的圆角大小 例如 CGSizeMake(20.0f, 20.0f)
 *  @param rect    需要设置的圆角view的rect
 */
- (void)addRoundedCorners:(UIRectCorner)corners withRadii:(CGSize)radii viewRect:(CGRect)rect;



/**
 快速设置圆角
 */
- (void)addLayerCornerRadius:(CGFloat)cornerRadius;

/**
 快速设置圆角边框
 */
- (void)addBorderLayer:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth cornerRadius:(CGFloat)cornerRadius;

// 添加多个子视图
- (void)HR_addSubViews:(UIView *)view, ...NS_REQUIRES_NIL_TERMINATION;

@end
